<?php

defined('API_PATH_CONFIG') or define('API_PATH_CONFIG', realpath(__DIR__));					// api/protected/config
defined('API_PATH_APP') or define('API_PATH_APP', realpath(API_PATH_CONFIG.'/../'));		// api/protected
defined('API_PATH_BASE') or define('API_PATH_BASE', realpath(API_PATH_APP.'/../'));			// api
defined('API_PATH_LIBS') or define('API_PATH_LIBS', realpath(API_PATH_BASE.'/../libs'));	// libs
defined('API_PATH_HAYZ') or define('API_PATH_HAYZ', API_PATH_LIBS.'/hayz');  //hayz
defined('API_PATH_YII') or define('API_PATH_YII', API_PATH_LIBS.'/yii');  //yii
// Yii::setPathOfAlias('local','path/to/local-folder');

// This is the main Web application configuration. Any writable
// CWebApplication properties can be configured here.
return array(
	'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
	'name'=>'销售管理后台',
	'language'=>'zh_cn',
	'timezone'=>'Asia/Shanghai',
	'homeUrl'=>'/site/index',

	'aliases' => array(
		'hayz'=>API_PATH_LIBS.'/hayz',
		'bootstrap' => 'application.modules.bootstrap3',
	),

	// preloading 'log' component
	'preload'=>array('log'),

	// autoloading model and component classes
	'import'=>array(
		'application.models.*',
		'application.components.*',
		'application.components.actions.*',
		'application.components.behaviors.*',
		'application.components.weixin.*',
		'application.extensions.yiinfinite-scroll.*',
		'bootstrap.*',
		'bootstrap.components.*',
		'bootstrap.models.*',
		'bootstrap.controllers.*',
		'bootstrap.helpers.*',
		'bootstrap.widgets.*',
		'bootstrap.extensions.*',
		'application.modules.user.models.*',
		'application.modules.user.components.*',
		'application.modules.auth.*',
		'application.modules.auth.components.*',
		'ext.*',
	),

	'modules'=>array(
		'bootstrap' => array(
				'class' => 'bootstrap.BootStrapModule'
		),
		'gii' => array(
			'generatorPaths' => array('bootstrap.gii'),
			'class'=>'system.gii.GiiModule',
			'password'=>'123456',
			'ipFilters'=>array('127.0.0.1', '::1', '*'),
        ),

		'auth' => array(
		  'strictMode' => true, // when enabled authorization items cannot be assigned children of the same type.
		  'userClass' => 'UserAdmin', // the name of the user model class.
		  'userIdColumn' => 'id', // the name of the user id column.
		  'userNameColumn' => 'user_name', // the name of the user name column.
		  'defaultLayout' => 'webroot.themes.avant.views.layouts.main', // the layout used by the module.
		  'viewDir' => null, // the path to view files to use with this module.
		),

		'admin',
		'custom',//客服
		'finance',//财务
		'market',//市场
		'operate',//运营
		'systems',//系统

	),

	// application components
	'components'=>array(
		'user'=>array(
			'class' => 'auth.components.AuthWebUser',
			// enable cookie-based authentication
			'allowAutoLogin'=>true,
			'loginUrl' => array('/admin/default/login'),
			'admins' => array('admin'),
		),

		'authManager' => array(
				'class' => 'auth.components.CachedDbAuthManager',
				'cachingDuration' => 3600,
				'behaviors' => array(
        			'auth' => array(
          				'class' => 'auth.components.AuthBehavior',),
     			 ),
				  'itemTable'=>'authitem',
     			 'itemChildTable'=>'authitemchild',
     			 'assignmentTable'=>'authassignment'
		 ),
		'bsHtml' => array(
                'class' => 'bootstrap.components.BSHtml'
            ),
		// uncomment the following to enable URLs in path-format

		'urlManager'=>array(
			'urlFormat'=>'path',
			'showScriptName'=>false, //隐藏index.php
			'rules'=>array(
				'<controller:\w+>/<id:\d+>'=>'<controller>/view',
				'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
				'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
			),
		),


		'db'=>array(
			'connectionString' => 'mysql:host=127.0.0.1;dbname=market',
			'emulatePrepare' => true,
			'username' => 'root',
			'password' => '',
			'charset' => 'utf8',
		),

		'errorHandler'=>array(
			// use 'site/error' action to display errors
			'errorAction'=>'site/error',
		),
		'log'=>array(
			'class'=>'CLogRouter',
			'routes'=>array(
				array(
					'class'=>'CFileLogRoute',
					'levels'=>'error, warning',
				),
				// uncomment the following to show log messages on web pages
				/*
				array(
					'class'=>'CWebLogRoute',
				),
				*/

			),
		),
	),

	// application-level parameters that can be accessed
	// using Yii::app()->params['paramName']
	'params'=>array(
		'adminEmail'=>'webmaster@example.com',
		'copyright'=>'&copy;2014销售管理综合服务平台',
		'defaultAvatar'=>'default_avatar.png',

	),
	'theme'=>'avant',
);